{$CLEO .cs}

//-------------MAIN---------------

03A4: name_thread 'DEALMOD' 

//GET HIGH
//DIFFERENT TYPE OF SMOKES
//TEXT MESSAGES      
//smoke in car        
                
:SMOKE_0 
04ED: load_animation "GANGS"
04ED: load_animation "DEALER" 
04ED: load_animation "SMOKING" 
04ED: load_animation "FIGHT_D"
0001: wait 0 ms 
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @SMOKE_0 
0001: wait 0 ms 
00D6: if 
80DF:   not actor $PLAYER_ACTOR driving 
004D: jump_if_false @SMOKE_0 
0001: wait 0 ms  
00D6: if 
03EE:   player $PLAYER_CHAR  controllable 
004D: jump_if_false @SMOKE_0 
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 11@ closest_ped_to 10@ 
0001: wait 0 ms 
00D6: if 
8039:   not  10@ == -1 
004D: jump_if_false @SMOKE_0
00D6: if or
02F2:   actor 10@ model == #BMYDRUG 
02F2:   actor 10@ model == #WMYDRUG 
02F2:   actor 10@ model == #HMYDRUG 
02F2:   actor 10@ model == #BIKDRUG 
004D: jump_if_false @SMOKE_0
0001: wait 0 ms
00D6: if
00F3:   actor $PLAYER_ACTOR near_actor 10@ radius 1.5 1.5 sphere 0 on_foot
004D: jump_if_false @SMOKE_0
0001: wait 0 ms
00D6: if
8118:   not actor 10@ dead 
jf @SMOKE_0  
jump @Decision_1

:Decision_1
0001: wait 0 ms 
00D6: if 
0AB0:   key_pressed 69 //e 
004D: jump_if_false @Decision_2
0002: jump @SMOKE_2

:Decision_2
0001: wait 0 ms 
00D6: if 
0AB0:   key_pressed 89 //y
jf @Decision_3
0A1D: AS_actor $PLAYER_ACTOR rotate_to_and_look_at_actor 10@
wait 500
0812: AS_actor $PLAYER_ACTOR perform_animation "Invite_No" IFP "Gangs" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time 3300
wait 3300
0459: end_thread_named 'DEALER'
0A1D: AS_actor 10@ rotate_to_and_look_at_actor $PLAYER_ACTOR
jump @SMOKE_0

:decision_3
0001: wait 0 ms 
00D6: if 
0AB0:   key_pressed 78 //n
jf @Decision_4
0459: end_thread_named 'DEALER'
0A1D: AS_actor $PLAYER_ACTOR rotate_to_and_look_at_actor 10@
wait 500
0812: AS_actor $PLAYER_ACTOR perform_animation "shake_carK" IFP "Gangs" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time 1000
wait 250
0812: AS_actor 10@ perform_animation "HitD_1" IFP "fight_D" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time 750
wait 750
05B9: AS_actor 10@ stay_idle 2000 ms
wait 2000
07A5: AS_actor 10@ attack_actor $PLAYER_ACTOR time -1
jump @SMOKE_0

:decision_4
0001: wait 0 ms 
00D6: if 
0AB0:   key_pressed 90
jf @Decision_1
0247: load_model 1212
0247: load_model 3044
0247: load_model #COLT45
0247: load_model 3045    
038B: load_requested_models
0001: wait 0 ms 
00D6: if 
04EE:   animation "GANGS" loaded 
004D: jump_if_false @Decision_4
0001: wait 0 ms 
00D6: if 
04EE:   animation "DEALER" loaded 
004D: jump_if_false @Decision_4
04D7: set_actor $PLAYER_ACTOR locked 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
0A1D: AS_actor $PLAYER_ACTOR rotate_to_and_look_at_actor 10@
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0
0350: set_actor 10@ maintain_position_when_attacked 1 
0446: set_actor 10@ dismemberment_possible 0 
0568: set_actor 10@ untargetable 1 
02AB: set_actor 10@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
0001: wait 0 ms 
067E: put_camera_on_actor $PLAYER_ACTOR offset 0.5 -1.0 1.1 target_actor 10@ tilt 0.0 switchstyle 2
029B: 9@ = init_object 1212 at 0.0 0.0 0.0   // Money
0382: set_object 9@ collision_detection 0    //Money
05C1: AS_actor $PLAYER_ACTOR speak_from_audio_table 194 
0812: AS_actor $PLAYER_ACTOR perform_animation "SHOP_PAY" IFP "DEALER" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1
0001: wait 1000 ms
070A: AS_actor $PLAYER_ACTOR attach_to_object 9@ offset 0.03 0.030 -0.02 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 0
0001: wait 3500 ms
0108: destroy_object 9@ 
0249: release_model 1212
0647: AS_actor 10@ clear_look_task
0109: player $PLAYER_CHAR money = -300
05C1: AS_actor 10@ speak_from_audio_table 84  
0687: clear_actor 10@ task
0459: end_thread_named 'DEALER'
0812: AS_actor 10@ perform_animation "DEALER_DEAL" IFP "DEALER" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 3200
0812: AS_actor $PLAYER_ACTOR perform_animation "DRUGS_BUY" IFP "DEALER" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 3200
0001: wait 2500 ms
03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
0350: set_actor 10@ maintain_position_when_attacked 0 
0446: set_actor 10@ dismemberment_possible 1
0568: set_actor 10@ untargetable 0 
02AB: set_actor 10@ immunities BP 0 FP 0 EP 0 CP 0 MP 0
04D7: set_actor $PLAYER_ACTOR locked 0
0001: wait 500 ms     
02EB: restore_camera_with_jumpcut
0605: actor 10@ perform_animation "DEALER_IDLE" IFP "DEALER" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1
jump @pill

:SMOKE_2   
0247: load_model 1212
0247: load_model 3044
0247: load_model #COLT45
0247: load_model 3045    
029B: 11@ = init_object 3044 at 0.0 0.0 0.0
038B: load_requested_models
0001: wait 0 ms 
00D6: if 
04EE:   animation "GANGS" loaded 
004D: jump_if_false @SMOKE_2
0001: wait 0 ms 
00D6: if 
04EE:   animation "DEALER" loaded 
004D: jump_if_false @SMOKE_2
04D7: set_actor $PLAYER_ACTOR locked 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
0A1D: AS_actor $PLAYER_ACTOR rotate_to_and_look_at_actor 10@
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0
0350: set_actor 10@ maintain_position_when_attacked 1 
0446: set_actor 10@ dismemberment_possible 0 
0568: set_actor 10@ untargetable 1 
02AB: set_actor 10@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
0001: wait 0 ms 
067E: put_camera_on_actor $PLAYER_ACTOR offset 0.5 -1.0 1.1 target_actor 10@ tilt 0.0 switchstyle 2
029B: 9@ = init_object 1212 at 0.0 0.0 0.0   // Money
0382: set_object 9@ collision_detection 0    //Money
05C1: AS_actor $PLAYER_ACTOR speak_from_audio_table 194 
0812: AS_actor $PLAYER_ACTOR perform_animation "SHOP_PAY" IFP "DEALER" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1
0001: wait 1000 ms
070A: AS_actor $PLAYER_ACTOR attach_to_object 9@ offset 0.03 0.030 -0.02 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 0
0001: wait 3500 ms
0108: destroy_object 9@ 
0249: release_model 1212
0647: AS_actor 10@ clear_look_task
0109: player $PLAYER_CHAR money = -20
05C1: AS_actor 10@ speak_from_audio_table 84  
0687: clear_actor 10@ task
0459: end_thread_named 'DEALER'
0812: AS_actor 10@ perform_animation "DEALER_DEAL" IFP "DEALER" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 3200
0812: AS_actor $PLAYER_ACTOR perform_animation "DRUGS_BUY" IFP "DEALER" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 3200
0001: wait 1500 ms
070A: AS_actor 10@ attach_to_object 11@ offset 0.04 0.1 0.05 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 0 
03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
0350: set_actor 10@ maintain_position_when_attacked 0 
0446: set_actor 10@ dismemberment_possible 1
0568: set_actor 10@ untargetable 0 
02AB: set_actor 10@ immunities BP 0 FP 0 EP 0 CP 0 MP 0
04D7: set_actor $PLAYER_ACTOR locked 0
0001: wait 1200 ms
0108: destroy_object 11@
0001: wait 500 ms     
02EB: restore_camera_with_jumpcut
0605: actor 10@ perform_animation "DEALER_IDLE" IFP "DEALER" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1
jump @SMOKE_3

:SMOKE_3
0247: load_model 3044
0247: load_model 3045
029B: 8@ = init_object 3044 at 0.0 0.0 0.0 
029B: 7@ = init_object 3045 at 0.0 0.0 0.0
069A: attach_object 7@ to_object 8@ with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0 
0812: AS_actor $PLAYER_ACTOR perform_animation "M_SMK_IN" IFP "SMOKING" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 time 6000
0001: wait 500 ms 
070A: AS_actor $PLAYER_ACTOR attach_to_object 8@ offset 0.04 0.1 0.05 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 15000
01C2: remove_references_to_actor 10@ // Like turning an actor into a random pedestrian
0669: 3@ = attach_particle "EXHALE" to_actor $PLAYER_ACTOR with_offset 0.05 0.20 -0.05 type 2 
0883: attach_particle 3@ to_actor $PLAYER_ACTOR mode 5 
0001: wait 3000 ms        
064C: make_particle 3@ visible     
0002: jump @SMOKE_4

:SMOKE_4
00D6: if 
0AB0:   key_pressed 85
004D: jump_if_false @SMOKE_5
0605: actor $PLAYER_ACTOR perform_animation "SMKCIG_PRTL" IFP "GANGS" framedelta 4.0 loop 0 lockX 0 lockY 0 lockF 0 time 7500 
0669: 29@ = attach_particle "EXHALE" to_actor $PLAYER_ACTOR with_offset 0.05 0.2 -0.05 type 2 
0883: attach_particle 29@ to_actor $PLAYER_ACTOR mode 5 
0001: wait 4000 ms
064C: make_particle 29@ visible 
0006: 9@ = 1 
0006: 33@ = 0 
0001: wait 2500 ms
052C: set_player $PLAYER_CHAR drunk_visuals 100
0002: jump @SMOKE_6

:SMOKE_5
00D6: if 
0AB0:   key_pressed 73
004D: jump_if_false @SMOKE_6
0605: actor $PLAYER_ACTOR perform_animation "M_SMK_DRAG" IFP "SMOKING" framedelta 4.0 loop 0 lockX 0 lockY 0 lockF 0 time 3700 
0669: 29@ = attach_particle "EXHALE" to_actor $PLAYER_ACTOR with_offset 0.05 0.2 -0.05 type 2 
0883: attach_particle 29@ to_actor $PLAYER_ACTOR mode 5 
0001: wait 1500 ms
064C: make_particle 29@ visible 
0006: 9@ = 1 
0006: 33@ = 0 
0001: wait 2200 ms
052C: set_player $PLAYER_CHAR drunk_visuals 100
jump @SMOKE_6

:SMOKE_6
0001: wait 0 ms
00D6: if or
0AB0:   key_pressed 13
0AB0:   key_pressed 69
0AB0:   key_pressed 81
0AB0:   key_pressed 17
004D: jump_if_false @SMOKE_4
0605: actor $PLAYER_ACTOR perform_animation "M_SMK_TAP" IFP "SMOKING" framedelta 4.0 loop 0 lockX 0 lockY 0 lockF 0 time 3000
0001: wait 1250 ms
0108: destroy_object  8@
0108: destroy_object  7@ 
04EF: release_animation "GANGS" 
04EF: release_animation "DEALER"
04EF: release_animation "SMOKING"
04EF: release_animation "FIGHT_C"
0249: release_model #COLT45
0001: wait 15000 ms
052C: set_player $PLAYER_CHAR drunk_visuals 0
0002: jump @SMOKE_0

:pill
0615: define_AS_pack_begin 3@
0605: actor -1 perform_animation_sequence "gum_eat" from_file "PED"  4.0  0  0  0  0 5000 ms  
0616: define_AS_pack_end 3@
0618: assign_actor $PLAYER_ACTOR to_AS_pack 3@
wait 8000
015D: set_gamespeed 0.8
052C: set_player $PLAYER_CHAR drunk_visuals 30
wait 5000
015D: set_gamespeed 0.6
052C: set_player $PLAYER_CHAR drunk_visuals 70
wait 3000
015D: set_gamespeed 0.4
052C: set_player $PLAYER_CHAR drunk_visuals 100
04F9: set_sky_color 1 fade 0
wait 3000
010D: set_player $PLAYER_CHAR wanted_level_to 1
wait 200
0851: set_actor $PLAYER_ACTOR decrease_health_by 50 affect_armour 0
wait 16000
015D: set_gamespeed 1.0
wait 250
04FA: reset_sky_colors_with_fade 0
wait 500 ms
052C: set_player $PLAYER_CHAR drunk_visuals 0
jump @smoke_0

